package StegoGUI;

import java.awt.Checkbox;
import java.awt.CheckboxGroup;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.SystemColor;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.File;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Vector;
import javax.swing.ButtonGroup;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JRadioButton;
import javax.swing.JSpinner;
import javax.swing.JTextField;
import javax.swing.JTextPane;
import javax.swing.SpinnerNumberModel;
import stego.Drivers;
import stego.StegoCaller.Caller_DownloadContent;
import stego.StegoCaller.Caller_UploadContent;

// Referenced classes of package StegoGUI:
//            StegoFileSelection

public class JPanel_AddCarrierImagePath_OR_UploadDestination extends JPanel
    implements ActionListener
{

    static StegoFileSelection parent;
    static String strMyClassName = "JPanel_AddDestinationImagePath_OR_UploadDestination";
    JPanel jpnlLoginName;
    JTextField jtfAccountName;
    JPanel jpnlPassword;
    JTextField jtfPassword;
    JPanel jpnlTag;
    JTextField jtfTag;
    JPanel jpnlCookiePaths;
    JTextField jtfCookieJAR;
    JPanel jpnlAccountType;
    Vector vctAccountType;
    JComboBox jcbAccountType;
    JButton jbtnRemoveDestinationAccountType;
    JButton jbtnBrowseToSelectMultipleImages;
    JButton jbtnBrowseToSelectDownloadContent;
    JPanel jpnlCarrierImagePath;
    JTextField jtfCarrierImagePath;
    JPanel jpnlRemovePath;
    JButton jbtnRemoveCarrierImagePath;
    JButton jbtnBrowseToAddCarrierImagePath;
    JPanel jpnlJSpinner;
    JSpinner jspinner_BytesToEmbed;
    JLabel jlblByteSpecification;
    CheckboxGroup cbg_AppendIndex;
    Checkbox cbYes_AppendIndex;
    Checkbox cbNo_AppendIndex;
    ButtonGroup group;
    JPanel jpnlRadioButtons;
    JRadioButton jrbYes_AppendIndex;
    JRadioButton jrbNo_AppendIndex;
    public boolean addThisPanel;
    public boolean thisIsUploadDestinationPanel;
    public boolean thisIsCarrierImagePath;
    public boolean thisIsCookieJAR;
    private boolean appendIndexToTag;
    private File fleMyFile;
    private String strAccountName;
    private String strPassword;
    private String strTag;
    private String strExternalCommand;
    private File arrSelectedFiles[];
    private File fleDownloadDestination;
    int myIndexNumber;
    int myContentEmbedSize;

    public JPanel_AddCarrierImagePath_OR_UploadDestination(StegoFileSelection stegoFileSelection, int loadParam, File destinationImagePath, String loginName, String password, String accountTypeURL)
    {
        jpnlLoginName = new JPanel();
        jtfAccountName = new JTextField(20);
        jpnlPassword = new JPanel();
        jtfPassword = new JTextField(10);
        jpnlTag = new JPanel();
        jtfTag = new JTextField(25);
        jpnlCookiePaths = new JPanel();
        jtfCookieJAR = new JTextField(95);
        jpnlAccountType = new JPanel();
        vctAccountType = new Vector();
        jcbAccountType = null;
        jbtnRemoveDestinationAccountType = new JButton("Remove");
        jbtnBrowseToSelectMultipleImages = new JButton("Select  Image(s)");
        jbtnBrowseToSelectDownloadContent = new JButton("Specify Location");
        jpnlCarrierImagePath = new JPanel();
        jtfCarrierImagePath = new JTextField(68);
        jpnlRemovePath = new JPanel();
        jbtnRemoveCarrierImagePath = new JButton("Remove");
        jbtnBrowseToAddCarrierImagePath = new JButton("Select Image");
        jpnlJSpinner = new JPanel();
        jspinner_BytesToEmbed = new JSpinner();
        jlblByteSpecification = new JLabel("Bytes");
        cbg_AppendIndex = new CheckboxGroup();
        cbYes_AppendIndex = new Checkbox("Yes", cbg_AppendIndex, false);
        cbNo_AppendIndex = new Checkbox("No", cbg_AppendIndex, true);
        group = new ButtonGroup();
        jpnlRadioButtons = new JPanel();
        jrbYes_AppendIndex = new JRadioButton("Yes");
        jrbNo_AppendIndex = new JRadioButton("No");
        addThisPanel = false;
        thisIsUploadDestinationPanel = false;
        thisIsCarrierImagePath = false;
        thisIsCookieJAR = false;
        appendIndexToTag = false;
        fleMyFile = null;
        strAccountName = " ";
        strPassword = " ";
        strTag = "";
        strExternalCommand = "";
        arrSelectedFiles = null;
        fleDownloadDestination = null;
        myIndexNumber = 0;
        myContentEmbedSize = 0;
        try
        {
            parent = stegoFileSelection;
            fleMyFile = destinationImagePath;
            if(loadParam == 0)
            {
                thisIsUploadDestinationPanel = true;
                vctAccountType.add("Twitter.com");
                if(StegoFileSelection.loadDownloadContent)
                {
                    jpnlLoginName.add(jbtnBrowseToSelectDownloadContent);
                } else
                if(StegoFileSelection.loadUploadContent)
                {
                    jpnlLoginName.add(jbtnBrowseToSelectMultipleImages);
                } else
                if(StegoFileSelection.loadDownloadContent == StegoFileSelection.loadUploadContent)
                {
                    jpnlLoginName.add(jbtnBrowseToSelectMultipleImages);
                }
                jpnlLoginName.add(jtfAccountName);
                jpnlLoginName.add(jtfPassword);
                jpnlLoginName.add(jtfTag);
                jcbAccountType = new JComboBox(vctAccountType);
                jpnlLoginName.add(jcbAccountType);
                group.add(jrbYes_AppendIndex);
                group.add(jrbNo_AppendIndex);
                jrbNo_AppendIndex.setSelected(true);
                jpnlLoginName.add(jrbYes_AppendIndex);
                jpnlLoginName.add(jrbNo_AppendIndex);
                jpnlLoginName.add(jbtnRemoveDestinationAccountType);
                add(jpnlLoginName);
                if(loginName != null && password != null && accountTypeURL != null)
                {
                    int selectedIndex = -1;
                    for(int i = 0; i < jcbAccountType.getItemCount(); i++)
                    {
                        if(jcbAccountType.getItemAt(i).toString().equalsIgnoreCase(accountTypeURL))
                        {
                            selectedIndex = i;
                        }
                    }

                    if(selectedIndex > -1)
                    {
                        jtfAccountName.setText(loginName);
                        jtfPassword.setText(password);
                        jcbAccountType.setSelectedIndex(selectedIndex);
                        addThisPanel = true;
                    }
                }
                jrbNo_AppendIndex.addActionListener(this);
                jrbYes_AppendIndex.addActionListener(this);
                if(StegoFileSelection.loadDownloadContent)
                {
                    jtfPassword.setEnabled(false);
                    jtfPassword.setBackground(SystemColor.scrollbar);
                    jtfTag.setEnabled(false);
                    jtfTag.setBackground(SystemColor.scrollbar);
                    jrbNo_AppendIndex.setEnabled(false);
                    jrbYes_AppendIndex.setEnabled(false);
                }
            } else
            if(loadParam == 1)
            {
                thisIsCarrierImagePath = true;
                jpnlCarrierImagePath.add(jbtnBrowseToAddCarrierImagePath);
                jpnlCarrierImagePath.add(jtfCarrierImagePath);
                jpnlCarrierImagePath.add(jbtnRemoveCarrierImagePath);
                jspinner_BytesToEmbed.setModel(new SpinnerNumberModel(0, 0, 0, 1));
                jspinner_BytesToEmbed.setPreferredSize(new Dimension(88, 20));
                jpnlCarrierImagePath.add(jspinner_BytesToEmbed);
                jpnlCarrierImagePath.add(jlblByteSpecification);
                add(jpnlCarrierImagePath);
                if(fleMyFile != null)
                {
                    jtfCarrierImagePath.setText(fleMyFile.toString());
                    jtfCarrierImagePath.setToolTipText(fleMyFile.toString());
                }
            } else
            if(loadParam == 2)
            {
                thisIsCookieJAR = true;
                add(jbtnBrowseToSelectMultipleImages);
                add(jtfCookieJAR);
                jtfCookieJAR.setEditable(false);
            }
            jbtnRemoveCarrierImagePath.setToolTipText("<html><b><u>Removes</b></u> the Carrier Image File Path</html>");
            jbtnBrowseToAddCarrierImagePath.setToolTipText("<html><b><u>Adds</b></u> the Carrier Image File Path</html>");
            jbtnRemoveCarrierImagePath.setToolTipText("Remove this image path");
            jbtnBrowseToAddCarrierImagePath.setToolTipText("Browse to Add a new Carrier Image path");
            jlblByteSpecification.setToolTipText("<html>(Bytes)<br/><b><u>Max Size Allowed:</b></u> 6000 bytes</html>");
            jspinner_BytesToEmbed.setToolTipText("Select a Carrier Image to continue...");
            jtfCarrierImagePath.setEditable(false);
            jtfCarrierImagePath.setOpaque(true);
            jtfAccountName.setOpaque(true);
            jtfPassword.setOpaque(true);
            jspinner_BytesToEmbed.setOpaque(true);
            jlblByteSpecification.setOpaque(true);
            jtfCookieJAR.setOpaque(true);
            jtfCookieJAR.setBackground(SystemColor.scrollbar);
            jbtnRemoveDestinationAccountType.addActionListener(this);
            jbtnRemoveCarrierImagePath.addActionListener(this);
            jbtnBrowseToAddCarrierImagePath.addActionListener(this);
            jbtnBrowseToSelectMultipleImages.addActionListener(this);
            jbtnBrowseToSelectDownloadContent.addActionListener(this);
        }
        catch(Exception e)
        {
            Drivers.eop("JPanel_AddDestinationImagePath_OR_UploadDestination Constructor", strMyClassName, e, e.getMessage(), true);
        }
    }

    public void actionPerformed(ActionEvent ae)
    {
        if(ae.getSource() == jbtnRemoveDestinationAccountType)
        {
            parent.removeUploadDestinationAccountsRow(getMyIndexNumber());
        } else
        if(ae.getSource() == jbtnRemoveCarrierImagePath)
        {
            parent.removeCarrierImagePath(getMyIndexNumber());
        } else
        if(ae.getSource() == jbtnBrowseToAddCarrierImagePath)
        {
            ae_jbtnAddSourceFile();
        } else
        if(ae.getSource() == jbtnBrowseToSelectMultipleImages)
        {
            ae_jbtnBrowseToSelectMultipleImages();
        } else
        if(ae.getSource() == jbtnBrowseToSelectDownloadContent)
        {
            ae_jbtnBrowseToSelectDownloadContent();
        } else
        if(ae.getSource() == jrbNo_AppendIndex)
        {
            appendIndexToTag = false;
        } else
        if(ae.getSource() == jrbYes_AppendIndex)
        {
            appendIndexToTag = true;
        }
    }

    public boolean ae_jbtnBrowseToSelectDownloadContent()
    {
        fleDownloadDestination = Drivers.querySelectFile(true, "Please Select the directory to contain the downloaded stego content", 1, false, false);
        if(fleDownloadDestination != null)
        {
            break MISSING_BLOCK_LABEL_39;
        }
        jbtnBrowseToSelectDownloadContent.setToolTipText("No Download Destination Selected");
        Drivers.sop("No File Selected. Nope, not for destination content.");
        return false;
        try
        {
            jbtnBrowseToSelectDownloadContent.setToolTipText(fleDownloadDestination.getCanonicalPath());
        }
        catch(Exception e)
        {
            Drivers.eop("ae_jbtnBrowseToSelectDownloadContent", strMyClassName, e, e.getLocalizedMessage(), true);
            return false;
        }
        return true;
    }

    public String queryExternalCommand()
    {
        strExternalCommand = Drivers.jop_Input((new StringBuilder("You indicated you wish to enter an external command for index [")).append(myIndexNumber).append("] to execute this jar file.\nPlease enter the External Command now:").toString(), "Enter External Command", false);
        if(strExternalCommand == null || strExternalCommand.trim().equals(""))
        {
            Drivers.jop_Error("No external Commands were received. \nAttempting to execute using commands alrea" +
"dy entered..."
, "External Commands Not Received");
            return "";
        } else
        {
            return strExternalCommand;
        }
    }

    public boolean call_Caller_DownloadContent(File flePath_To_Downloader_JAR, JTextPane jtxtpneOut, boolean useNative_API, boolean useCustom_Instructions, boolean useExternal_Instructions)
    {
        try
        {
            if(useExternal_Instructions)
            {
                queryExternalCommand();
            }
            Caller_DownloadContent downloader = new Caller_DownloadContent(flePath_To_Downloader_JAR, fleDownloadDestination, strAccountName, strPassword, jtxtpneOut, useNative_API, useCustom_Instructions, useExternal_Instructions, strExternalCommand);
        }
        catch(Exception e)
        {
            Drivers.eop("call_Caller_DownloadContent", strMyClassName, e, e.getLocalizedMessage(), true);
            return false;
        }
        return true;
    }

    public boolean call_Caller_UploadContent(File flePath_To_Uploader_JAR, JTextPane jtxtpneOut, boolean useNative_API, boolean useCustom_Instructions, boolean useExternal_Instructions)
    {
        try
        {
            if(useExternal_Instructions)
            {
                queryExternalCommand();
            }
            Caller_UploadContent uploader = new Caller_UploadContent(appendIndexToTag, flePath_To_Uploader_JAR, arrSelectedFiles, strAccountName, strPassword, strTag, jcbAccountType.getSelectedIndex(), jtxtpneOut, useNative_API, useCustom_Instructions, useExternal_Instructions, strExternalCommand);
        }
        catch(Exception e)
        {
            Drivers.eop("call_Caller_UploadContent", strMyClassName, e, e.getLocalizedMessage(), true);
            return false;
        }
        return true;
    }

    private boolean ae_jbtnBrowseToSelectMultipleImages()
    {
        try
        {
            String prompt = "";
            if(thisIsCarrierImagePath)
            {
                prompt = "Please Select the Carrier Images to upload";
            } else
            if(thisIsCookieJAR)
            {
                prompt = "Please Select the JAR files to package";
            }
            arrSelectedFiles = Drivers.querySelectMultipleFile(true, prompt, 0, false, false);
            if(arrSelectedFiles != null && arrSelectedFiles.length > 0)
            {
                String file = "File";
                if(arrSelectedFiles.length > 1)
                {
                    file = "Files";
                }
                String strSelectedFiles = "<html>";
                String strSelectedFiles_Long = "";
                strSelectedFiles = (new StringBuilder("<br/>")).append(arrSelectedFiles[0].getCanonicalPath()).toString();
                strSelectedFiles_Long = arrSelectedFiles[0].getCanonicalPath();
                for(int i = 1; i < arrSelectedFiles.length; i++)
                {
                    strSelectedFiles = (new StringBuilder(String.valueOf(strSelectedFiles))).append("<br/>").append(arrSelectedFiles[i].getCanonicalPath()).toString();
                    strSelectedFiles_Long = (new StringBuilder(String.valueOf(strSelectedFiles_Long))).append(", ").append(arrSelectedFiles[i].getCanonicalPath()).toString();
                }

                strSelectedFiles = (new StringBuilder(String.valueOf(strSelectedFiles))).append("</html>").toString();
                jbtnBrowseToSelectMultipleImages.setToolTipText((new StringBuilder("<html><b><u>(")).append(arrSelectedFiles.length).append(") ").append(file).append(" Selected:</u></b>").append(strSelectedFiles).toString());
                jtfCookieJAR.setToolTipText((new StringBuilder("<html><b><u>(")).append(arrSelectedFiles.length).append(") ").append(file).append(" Selected:</u></b>").append(strSelectedFiles).toString());
                if(thisIsCookieJAR)
                {
                    jtfCookieJAR.setText(strSelectedFiles_Long);
                    jtfCookieJAR.setBackground(Color.white);
                }
            } else
            {
                jbtnBrowseToSelectMultipleImages.setToolTipText("<html><b><u>(0) Files Selected:</u></b>");
                jtfCookieJAR.setToolTipText("<html><b><u>(0) Files Selected:</u></b>");
                jtfCookieJAR.setText("No Files Selected");
                jtfCookieJAR.setBackground(SystemColor.scrollbar);
            }
        }
        catch(Exception e)
        {
            Drivers.eop("jbtnBrowseToSelectUploadImages", strMyClassName, e, e.getLocalizedMessage(), true);
            return false;
        }
        return true;
    }

    public boolean ae_jbtnAddSourceFile()
    {
        try
        {
            fleMyFile = Drivers.querySelectFile(true, "Please Select the Carrier Image to hold the Steganographic content", 0, false, true);
            if(fleMyFile == null)
            {
                jtfCarrierImagePath.setToolTipText("No Carrier Destination File Selected");
            } else
            {
                jtfCarrierImagePath.setText(fleMyFile.getCanonicalPath());
                jtfCarrierImagePath.setToolTipText(fleMyFile.getCanonicalPath());
                try
                {
                    long fleSize = fleMyFile.length();
                    jspinner_BytesToEmbed.setModel(new SpinnerNumberModel(0.0D, 0.0D, fleSize, 1.0D));
                    jspinner_BytesToEmbed.setToolTipText((new StringBuilder("Maximum number of bytes this Carrier Image can contain: ")).append(Drivers.getFormattedFileSize_String(fleSize)).toString());
                }
                catch(Exception e)
                {
                    Drivers.eop("ae_jbtnAddSourceFile", strMyClassName, e, "Perhaps the File is null which is preventing us from setting from setting the ma" +
"ximum grow size"
, true);
                }
            }
            try
            {
                StegoFileSelection.indicateTotalCarrierFileSize();
            }
            catch(Exception exception) { }
        }
        catch(Exception e)
        {
            Drivers.eop("ae_jbtnAddSource", strMyClassName, e, e.getMessage(), true);
            return false;
        }
        return true;
    }

    public void setMyIndexNumber(int numToSet)
    {
        myIndexNumber = numToSet;
    }

    public boolean myFileExists()
    {
        if(fleMyFile != null && fleMyFile.isFile())
        {
            return true;
        }
        break MISSING_BLOCK_LABEL_35;
        Exception e;
        e;
        Drivers.eop("myFileExists", strMyClassName, e, e.getMessage(), true);
        return false;
    }

    public int getMyIndexNumber()
    {
        return myIndexNumber;
    }

    public String getAccountInfo_CSV()
    {
        if(thisIsCarrierImagePath)
        {
            return null;
        }
        String strLoginName;
        String strPassword;
        String strAccountType;
        strLoginName = jtfAccountName.getText();
        strPassword = jtfPassword.getText();
        strAccountType = jcbAccountType.getSelectedItem().toString();
        if(strLoginName == null || strLoginName.trim().equals(""))
        {
            return null;
        }
        if(strPassword == null || strPassword.trim().equals(""))
        {
            return null;
        }
        if(strAccountType == null || strAccountType.trim().equals(""))
        {
            return null;
        }
        return (new StringBuilder(String.valueOf(strLoginName))).append(",").append(strPassword).append(",").append(strAccountType).toString();
        Exception e;
        e;
        Drivers.eop("getAccountInfo_CSV", strMyClassName, e, e.getMessage(), true);
        return null;
    }

    private boolean verifyMyTag()
    {
        if(jtfTag.getText() == null || jtfTag.getText().trim().equals(""))
        {
            break MISSING_BLOCK_LABEL_87;
        }
        strTag = jtfTag.getText().trim();
        jtfTag.setBackground(Color.white);
        return true;
        Exception e;
        e;
        Drivers.eop((new StringBuilder("verifyMyTag  my index: ")).append(myIndexNumber).toString(), strMyClassName, e, e.getMessage(), true);
        strTag = "";
        jtfTag.setBackground(Color.yellow);
        return false;
    }

    private boolean verifyMyPassword()
    {
        if(jtfPassword.getText() == null || jtfPassword.getText().trim().equals(""))
        {
            break MISSING_BLOCK_LABEL_87;
        }
        strPassword = jtfPassword.getText().trim();
        jtfPassword.setBackground(Color.white);
        return true;
        Exception e;
        e;
        Drivers.eop((new StringBuilder("verifyMyPassword  my index: ")).append(myIndexNumber).toString(), strMyClassName, e, e.getMessage(), true);
        strPassword = "";
        jtfPassword.setBackground(Color.yellow);
        return false;
    }

    private boolean verifyMyExternalCommand()
    {
        if(StegoFileSelection.jar_EnterExternalCommands)
        {
            return strExternalCommand != null && !strExternalCommand.trim().equals("");
        } else
        {
            return true;
        }
        Exception e;
        e;
        Drivers.eop((new StringBuilder("verifyMyExternalCommand  my index: ")).append(myIndexNumber).toString(), strMyClassName, e, e.getMessage(), true);
        return false;
    }

    private boolean verifyMyAccountName()
    {
        if(jtfAccountName.getText() == null || jtfAccountName.getText().trim().equals(""))
        {
            break MISSING_BLOCK_LABEL_87;
        }
        strAccountName = jtfAccountName.getText().trim();
        jtfAccountName.setBackground(Color.white);
        return true;
        Exception e;
        e;
        Drivers.eop((new StringBuilder("verifyMyLoginName  my index: ")).append(myIndexNumber).toString(), strMyClassName, e, e.getMessage(), true);
        strAccountName = "";
        jtfAccountName.setBackground(Color.yellow);
        return false;
    }

    public boolean verifyMy_AccountInformation()
    {
        boolean okToContinue = false;
        if(StegoFileSelection.loadUploadContent)
        {
            okToContinue = verifyMySelectedImages() & verifyMyAccountName() & verifyMyPassword() & verifyMyTag();
        } else
        if(StegoFileSelection.loadDownloadContent)
        {
            okToContinue = verifyMyDownloadLocation() & verifyMyAccountName();
        } else
        {
            okToContinue = true;
        }
        if(!okToContinue)
        {
            break MISSING_BLOCK_LABEL_120;
        }
        Drivers.sop((new StringBuilder("\t\tAccount Info Verification at index [")).append(myIndexNumber).append("] - No Errors detected").toString());
        return true;
        Exception e;
        e;
        Drivers.eop((new StringBuilder("verifyMy_AccountInformation  my index: ")).append(myIndexNumber).toString(), strMyClassName, e, e.getMessage(), true);
        Drivers.sop((new StringBuilder("\t\t Account Info Verification at index [")).append(myIndexNumber).append("] - * * * ERRORS DETECTED * * * - File does not appear to exist").toString());
        return false;
    }

    public boolean verifyMySelectedImages()
    {
        if(arrSelectedFiles != null && arrSelectedFiles.length >= 1)
        {
            break MISSING_BLOCK_LABEL_28;
        }
        jbtnBrowseToSelectMultipleImages.setBackground(Color.red);
        return false;
        try
        {
            jbtnBrowseToSelectMultipleImages.setBackground(Color.white);
        }
        catch(Exception e)
        {
            Drivers.eop("verifyMySelectedImages", strMyClassName, e, e.getLocalizedMessage(), true);
            return false;
        }
        return true;
    }

    public boolean verifyMyDownloadLocation()
    {
        if(fleDownloadDestination != null && fleDownloadDestination.exists())
        {
            break MISSING_BLOCK_LABEL_29;
        }
        jbtnBrowseToSelectDownloadContent.setBackground(Color.red);
        return false;
        try
        {
            jbtnBrowseToSelectDownloadContent.setBackground(Color.white);
        }
        catch(Exception e)
        {
            Drivers.eop("verifyMyDownloadLocation", strMyClassName, e, e.getLocalizedMessage(), true);
            return false;
        }
        return true;
    }

    public boolean verifyMyCarrierImageContentEmbedSize(boolean printVerificationInformation)
    {
        Exception e;
        if(fleMyFile == null || !fleMyFile.exists() || !fleMyFile.isFile())
        {
            break MISSING_BLOCK_LABEL_207;
        }
        myContentEmbedSize = -1;
        try
        {
            SpinnerNumberModel model = (SpinnerNumberModel)jspinner_BytesToEmbed.getModel();
            myContentEmbedSize = model.getNumber().intValue();
        }
        // Misplaced declaration of an exception variable
        catch(Exception e)
        {
            myContentEmbedSize = -1;
        }
        if(StegoFileSelection.algorithm_ImportExternal_JAR && StegoFileSelection.loadExtractContent)
        {
            myContentEmbedSize = 1;
        }
        if(myContentEmbedSize <= 0 || (long)myContentEmbedSize > fleMyFile.length() || myContentEmbedSize >= 6000 || myContentEmbedSize >= 0x7fffff9b)
        {
            break MISSING_BLOCK_LABEL_198;
        }
        if(printVerificationInformation)
        {
            Drivers.sop((new StringBuilder("\t\tCarrier Destination Image Embed Content Size at index [")).append(myIndexNumber).append("] - No Errors detected").toString());
        }
        jspinner_BytesToEmbed.setBackground(Color.white);
        jspinner_BytesToEmbed.setForeground(Color.black);
        jlblByteSpecification.setBackground(Color.white);
        jlblByteSpecification.setForeground(Color.black);
        return true;
        Drivers.sop("Carrier Image Not initialized yet");
        break MISSING_BLOCK_LABEL_251;
        throw new Exception("Invalid data verification.  Carrier file is null. Perhaps data verification has " +
"not completed."
);
        e;
        Drivers.eop((new StringBuilder("verifyMyCarrierImageContentEmbedSize  my index: ")).append(myIndexNumber).toString(), strMyClassName, e, e.getMessage(), false);
        jspinner_BytesToEmbed.setBackground(Color.yellow);
        jspinner_BytesToEmbed.setForeground(Color.red);
        jlblByteSpecification.setForeground(Color.red);
        jlblByteSpecification.setBackground(Color.yellow);
        Drivers.sop((new StringBuilder("\t\tCarrier Destination Image Embed Content Size at index [")).append(myIndexNumber).append("] - * * * ERRORS DETECTED * * * - it does not appear user entered a valid number" +
" within expected range or exceeds max allowed size of "
).append(6000).append(" bytes").toString());
        return false;
    }

    public boolean verifyMyCarrierImagePath()
    {
        if(fleMyFile == null || !fleMyFile.exists() || !fleMyFile.isFile())
        {
            break MISSING_BLOCK_LABEL_101;
        }
        Drivers.sop((new StringBuilder("\t\tCarrier Destination Image Verification at index [")).append(myIndexNumber).append("] - No Errors detected").toString());
        jtfCarrierImagePath.setBackground(Color.white);
        return true;
        Exception e;
        e;
        Drivers.eop((new StringBuilder("verifyMyCarrierImagePath  my index: ")).append(myIndexNumber).toString(), strMyClassName, e, e.getMessage(), true);
        jtfCarrierImagePath.setBackground(Color.yellow);
        Drivers.sop((new StringBuilder("\t\tCarrier Destination Image Verification at index [")).append(myIndexNumber).append("] - * * * ERRORS DETECTED * * * - File does not appear to exist or be a file").toString());
        return false;
    }

    public boolean isCarrierImageNode()
    {
        return thisIsCarrierImagePath;
    }

    public boolean clearMyGUI()
    {
        try
        {
            if(jtfAccountName != null)
            {
                jtfAccountName.setBackground(Color.WHITE);
                jtfAccountName.setForeground(Color.black);
            }
            if(jtfPassword != null)
            {
                jtfPassword.setBackground(Color.WHITE);
                jtfPassword.setForeground(Color.black);
            }
        }
        catch(Exception e)
        {
            Drivers.eop("clearMyGUI", strMyClassName, e, e.getLocalizedMessage(), true);
            return false;
        }
        return true;
    }

    public int getMyEmbedContentinCarrierFileSize(boolean printVerificationInformation)
    {
        if(thisIsCarrierImagePath && myFileExists())
        {
            verifyMyCarrierImageContentEmbedSize(printVerificationInformation);
            return myContentEmbedSize;
        } else
        {
            return 0;
        }
    }

    public ArrayList getSelectedFiles_CookieJAR(String acceptableFileExtensions[])
    {
        if(arrSelectedFiles == null || arrSelectedFiles.length < 1)
        {
            return null;
        }
        ArrayList alToReturn;
        String strFleExtension = "";
        alToReturn = new ArrayList();
        java.util.List lstAcceptableFileExtensions = null;
        if(acceptableFileExtensions != null)
        {
            lstAcceptableFileExtensions = Arrays.asList(acceptableFileExtensions);
        }
        for(int i = 0; i < arrSelectedFiles.length; i++)
        {
            if(arrSelectedFiles[i].isFile())
            {
                if(lstAcceptableFileExtensions != null)
                {
                    strFleExtension = Drivers.getFileExtension(arrSelectedFiles[i], false).replace(".", "");
                    if(lstAcceptableFileExtensions.contains(strFleExtension.toLowerCase()) || lstAcceptableFileExtensions.contains(strFleExtension.toUpperCase()))
                    {
                        alToReturn.add(arrSelectedFiles[i]);
                    }
                } else
                {
                    alToReturn.add(arrSelectedFiles[i]);
                }
            }
        }

        return alToReturn;
        Exception e;
        e;
        Drivers.eop("getSelectedFiles_CookieJAR", strMyClassName, e, e.getLocalizedMessage(), true);
        return null;
    }

    public byte[] getMyEmbedContentSize(boolean printVerificationInformation)
    {
        String strEmbedSize;
        String maxEmbedSize = "6000";
        int embedSize = getMyEmbedContentinCarrierFileSize(printVerificationInformation);
        if(embedSize < 1 || embedSize > 6000)
        {
            throw new Exception("embed size is not within expected limits.  Caught in getMyEmbedContentSize mtd i" +
"n JPanel_AddCarrier... "
);
        }
        if(embedSize > 0x7fffff9b)
        {
            throw new Exception((new StringBuilder("EmbedSize exceeds max int value for Java.  Cannot continue with current size of:" +
" "
)).append(embedSize).append(" bytes").toString());
        }
        strEmbedSize = (new StringBuilder()).append(embedSize).toString();
        int leadingZerosNeededToFormatSize = maxEmbedSize.length() - strEmbedSize.length();
        for(int i = 0; i < leadingZerosNeededToFormatSize; i++)
        {
            strEmbedSize = (new StringBuilder("0")).append(strEmbedSize).toString();
            if(strEmbedSize.length() == maxEmbedSize.length())
            {
                break;
            }
        }

        return strEmbedSize.getBytes();
        Exception e;
        e;
        Drivers.eop("getMyEmbedContentSize", strMyClassName, e, e.getLocalizedMessage(), true);
        return null;
    }

    public long getMyCarrierFileSize()
    {
        if(thisIsCarrierImagePath && myFileExists())
        {
            return fleMyFile.length();
        } else
        {
            return 0L;
        }
    }

    public File getMyCarrierFilePath()
    {
        return fleMyFile;
    }

    public void setExternalCommand(String strToSet)
    {
        strExternalCommand = strToSet;
    }

}
